﻿namespace Suture.StubGeneration
{
    using System;

    internal class DefaultStubGenerator : IStubGenerator
    {
        public T GenerateStub<T>() where T : class
        {
            if (typeof(T).IsAbstract && !typeof(T).IsInterface)
            {
                throw new NotSupportedException("Abstract classes are not supported for auto stubbing yet, sorry");
            }

            return typeof(T).IsInterface ? SimpleDynamicProxy.CreateStub<T>() : default(T);
        }
    }
}